package com.bw.controller;

import com.bw.bean.KeyWord;
import com.bw.service.impi.DorisService;
import com.bw.util.DateFormatUtil;
import com.bw.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/gmall/api")
@RestController
public class DorisController {
    //嘿嘿
    @Autowired
    private DorisService dorisService;

    @RequestMapping("/cc")
    public R<String> getCc(@RequestParam(value = "date",defaultValue = "0")String date) {
        if ("0".equals(date)) {
            date = DateFormatUtil.getNowDate();
        }
        return R.success(dorisService.getMv(date));
    }


    @RequestMapping("/keyword")
    public R<List<KeyWord>> getkeyWord(@RequestParam(value = "date",defaultValue = "0")String date) {
        if ("0".equals(date)) {
            date = DateFormatUtil.getNowDate();
        }
        return R.success(dorisService.getkeyWord(date));
    }
}
